//    Copyright (C) Kherty.  All rights reserved.
using System;

namespace OpenLS.Spreadsheet.Extensibility
{
    public class AllowDateTimeToDoubleConversionAttribute : ParameterConverterAttribute
    {
        public AllowDateTimeToDoubleConversionAttribute()
            : base(ReferenceOption.ArgumentOrReference)
        {
        }
        internal override void ConvertImp(ConversionData data)
        {
            if (data.TargetType == typeof(double))
            {
                if (data.Value is DateTime)
                    data.Result = data.Workbook.DateTimeToDouble((DateTime) data.Value);
                   
            }
        }
    }
}